package com.yonyou.crm.sys.dataright.ctrl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.yonyou.crm.common.exception.CrmMessageException;
import com.yonyou.crm.common.rest.util.ResponseUtil;
import com.yonyou.crm.sys.dataright.rmitf.IRightRmService;

@RestController
@RequestMapping(value = "/sys/right")
public class RightCtrl {
	
	@Autowired
	private IRightRmService service;
	
	/**
	 * 获取权限明细
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "{roleId}/{objId}/{actionId}", method = RequestMethod.GET)
	public Object detail(@PathVariable("roleId") Long roleId,
			@PathVariable("objId") Long objId,
			@PathVariable("actionId") Long actionId,
			HttpServletRequest request, HttpServletResponse response)
			throws CrmMessageException {
		service.hasRight(roleId, objId, actionId,175L);
		service.filterWithRight(roleId, objId, actionId, new Long[]{175L,166L});
		service.getRightConfig(roleId, objId, actionId);
		Object t = service.filterWithRight(roleId, objId, actionId, new Long[]{175L,166L});
		return ResponseUtil.getObject(t);
	}
}
